package com.cyf.util;

import com.cyf.db.bean.PayOrder;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 支付消息的工具类
 * 详情：下发车场，车场在入场信息中保存支付信息
 * Created by cage on 2017/2/28.
 */
public class PayOrderMessageList {

    private static final List<PayOrder> payOrderMessageList = new ArrayList<>();

    public static void addPayOrderMessage(PayOrder payOrder){
        synchronized (PayOrderMessageList.class) {
            if (payOrderMessageList.size() == 1000) {
                payOrderMessageList.remove(0);
            }
            payOrderMessageList.add(payOrder);
        }
    }

    public static PayOrder getPayOrderMessage(){
        synchronized (PayOrderMessageList.class) {
            if (payOrderMessageList.size() > 0) {
                return payOrderMessageList.remove(0);
            }
        }
        return null;
    }

    public static class PayOrderMessage {

        /* 类型：支付停车费 */
        public static final int TYPE_PAYFEE = 1;
        /* 类型：充值 */
        public static final int TYPE_RECHARGE = 2;

        private String plate;
        private Integer fee;
        private String outTime;     // 预计出场时间
        private Integer parkingId;
        private Date payTime;       // 支付时间
        private int month;      // 月卡充值月数
        private int type;       // 类型
        private int payOrderId;
        private Integer infoId;
        private Integer infoType;

        public PayOrderMessage() {
        }

        public PayOrderMessage(String plate, Integer fee, String outTime, Integer parkingId, Date payTime, int type, int payOrderId, Integer infoId, Integer infoType) {
            this.plate = plate;
            this.fee = fee;
            this.outTime = outTime;
            this.parkingId = parkingId;
            this.payTime = payTime;
            this.type = type;
            this.payOrderId = payOrderId;
            this.infoId = infoId;
            this.infoType = infoType;
        }

        public PayOrderMessage(String plate, Integer fee, int month, Integer parkingId, Date payTime, int type, int payOrderId) {
            this.plate = plate;
            this.fee = fee;
            this.month = month;
            this.parkingId = parkingId;
            this.payTime = payTime;
            this.type = type;
            this.payOrderId = payOrderId;
        }

        public String getPlate() {
            return plate;
        }

        public void setPlate(String plate) {
            this.plate = plate;
        }

        public Integer getFee() {
            return fee;
        }

        public void setFee(Integer fee) {
            this.fee = fee;
        }

        public String getOutTime() {
            return outTime;
        }

        public void setOutTime(String outTime) {
            this.outTime = outTime;
        }

        public Integer getParkingId() {
            return parkingId;
        }

        public void setParkingId(Integer parkingId) {
            this.parkingId = parkingId;
        }

        public Date getPayTime() {
            return payTime;
        }

        public void setPayTime(Date payTime) {
            this.payTime = payTime;
        }

        public int getMonth() {
            return month;
        }

        public void setMonth(int month) {
            this.month = month;
        }

        public int getType() {
            return type;
        }

        public void setType(int type) {
            this.type = type;
        }

        public int getPayOrderId() {
            return payOrderId;
        }

        public void setPayOrderId(int payOrderId) {
            this.payOrderId = payOrderId;
        }

        public Integer getInfoId() {
            return infoId;
        }

        public void setInfoId(Integer infoId) {
            this.infoId = infoId;
        }

        public Integer getInfoType() {
            return infoType;
        }

        public void setInfoType(Integer infoType) {
            this.infoType = infoType;
        }
    }
}
